package com.yunbiao.ybbusstopplate.ui.view.subway;

import android.content.Context;
import android.graphics.*;
import android.util.Log;
import android.view.View;
import androidx.core.view.ViewCompat;

import com.yunbiao.ybbusstopplate.BuildConfig;
import com.yunbiao.ybbusstopplate.serialport.SerialPortConfig;
import com.yunbiao.ybbusstopplate.ui.activity.FlavorType;
import com.yunbiao.ybbusstopplate.utils.SpTool;

import java.util.List;


/* renamed from: com.tmindtech.subway.ui.StationMap */
public class StationMap3 extends StationMap {
    private static final String TAG = "StationMap3";
    public static int STATIONMAP_FLAGHEIGHT = 60;
    //    public static int STATIONMAP_MAXFONTSIZE = 36;
    public static int STATIONMAP_MAXFONTSIZE = 34;
    public static String Symbol = "..........";
    float offset_right = 100f;
    private int MapCount;
    //    private String[] NameString;
    private List<String[]> NameString;
    private int StationCur;
    private int StationMap_height;
    private int StationMap_width;
    private int StationNum;
    private Paint StrPaint;
    private int SymbolWidth;
    private int stylecolor;
    private float y_offset;
    private int limitStationNum = 50;

    public StationMap3(Context context, List<String[]> strlist, int limitStationNum) {
        super(context);
        this.limitStationNum = limitStationNum;
        varInit(strlist);
    }

    private void varInit(List<String[]> strlist) {
        this.StationMap_width = 1920;
        this.StationMap_height = 400;
        this.StationNum = strlist.size();
        this.StationCur = 0;
        this.NameString = strlist;
        this.StrPaint = new Paint();
        AutoSetSize();
        this.stylecolor = Color.argb(255, 230, 255, 230);
    }

    private void AutoSetSize() {
        if (this.StationNum <= limitStationNum) {
            this.MapCount = NameString.size();
            this.SymbolWidth = 0;
        } else {
            this.MapCount = 16;
            this.SymbolWidth = 120;
        }
        this.y_offset = ((this.StationMap_width - 80 - offset_right) - this.SymbolWidth) / ((float) this.MapCount) * 2;
        if (this.y_offset - 2.0f > ((float) STATIONMAP_MAXFONTSIZE)) {
            this.StrPaint.setTextSize((float) STATIONMAP_MAXFONTSIZE);
        } else {
            this.StrPaint.setTextSize(this.y_offset - 2.0f);
        }
    }

    private void drawStationNameText(Canvas canvas, float offset, int index) {
        float ascent;
        float descent;
        float mFontHeight;
        float h_Spacing = 2.0f;
        float h_offset;
        String[] array = this.NameString.get(index);
        index = Integer.parseInt(array[0]);
        String text = array[1];
        this.StrPaint.setTextAlign(Paint.Align.CENTER);
        this.StrPaint.setAntiAlias(true);
        float fontsize = this.StrPaint.getTextSize();
        do {
            Paint.FontMetrics fm = this.StrPaint.getFontMetrics();
            ascent = fm.ascent;
            descent = fm.descent;
            mFontHeight = (float) Math.ceil((double) (descent - ascent));
            if(BuildConfig.FLAVOR_TYPE == FlavorType.LESHAN){
                h_Spacing = 0;
            } else {
                h_Spacing = (((float) ((this.StationMap_height / 2 - STATIONMAP_FLAGHEIGHT) - 30)) - (((float) text.length()) * mFontHeight)) / ((float) (text.length() - 1));
            }
            h_offset = (((float) ((this.StationMap_height / 2 - STATIONMAP_FLAGHEIGHT) - 30)) - mFontHeight) / ((float) (text.length() - 1));
            if (h_offset <= this.StrPaint.getTextSize()) {
                this.StrPaint.setTextSize(this.StrPaint.getTextSize() - 1.0f);
            }
        } while (h_offset <= this.StrPaint.getTextSize());

        if (this.StationNum % 2 == 0) {

            if (index < this.StationNum / 2) {
                if (index < this.StationCur) {
                    this.StrPaint.setColor(Color.parseColor("#8E8E8E"));
                } else if (index == this.StationCur) {
                    Paint rectPaint = new Paint();
                    rectPaint.setStyle(Paint.Style.FILL);
                    rectPaint.setColor(Color.parseColor("#C52B24"));
                    canvas.drawRoundRect(new RectF((offset - (this.StrPaint.getTextSize() / 2.0f)) - 3.0f, (float) (STATIONMAP_FLAGHEIGHT - 5), (this.StrPaint.getTextSize() / 2.0f) + offset + 3.0f, (float) (this.StationMap_height / 2 - 25)), 5f, 5f, rectPaint);
                    this.StrPaint.setColor(Color.parseColor("#ffffff"));
                } else {
                    this.StrPaint.setColor(Color.parseColor("#121212"));
                }
                float y = (float) STATIONMAP_FLAGHEIGHT;
                for (int n = 0; n < text.length(); n++) {
                    char ch = text.charAt(n);
                    if (ch == 65288 || ch == 65289 || ch == '(' || ch == ')') {
                        Path path = new Path();
                        path.moveTo(offset, y - h_Spacing);
                        path.lineTo(offset, y + mFontHeight);
                        canvas.drawTextOnPath(String.valueOf(ch), path, 0.0f, descent, this.StrPaint);
                    } else {
                        Canvas canvas2 = canvas;
                        float f = offset;
                        canvas2.drawText(String.valueOf(ch), f, y - ascent, this.StrPaint);
                    }
                    y += h_Spacing + mFontHeight;
                }

            } else {
                int newPos = this.StationNum - index - 1;
                float textOffset = (this.y_offset * ((float) newPos)) + 50.0f + (this.y_offset / 2.0f);
                if (index < this.StationCur) {
                    this.StrPaint.setColor(Color.parseColor("#8E8E8E"));
                } else if (index == this.StationCur) {
                    Paint rectPaint = new Paint();
                    rectPaint.setStyle(Paint.Style.FILL);
                    rectPaint.setColor(Color.parseColor("#C52B24"));
                    canvas.drawRoundRect(new RectF((textOffset - (this.StrPaint.getTextSize() / 2.0f)) - 3.0f, (float) (STATIONMAP_FLAGHEIGHT - 5) + this.StationMap_height / 2, (this.StrPaint.getTextSize() / 2.0f) + textOffset + 3.0f, (float) (this.StationMap_height - 25)), 5f, 5f, rectPaint);
                    this.StrPaint.setColor(Color.parseColor("#ffffff"));
                } else {
                    this.StrPaint.setColor(Color.parseColor("#121212"));
                }

                float y = (float) STATIONMAP_FLAGHEIGHT;
//                Log.e(TAG, "drawStationNameText-----------textOffset------------------------- " + textOffset);

                for (int n = 0; n < text.length(); n++) {
                    char ch = text.charAt(n);
                    if (ch == 65288 || ch == 65289 || ch == '(' || ch == ')') {
                        Path path = new Path();
                        path.moveTo(textOffset, y - h_Spacing);
                        path.lineTo(textOffset, y + mFontHeight);
                        canvas.drawTextOnPath(String.valueOf(ch), path, 0.0f, descent, this.StrPaint);
                    } else {
                        Canvas canvas2 = canvas;
                        float f = textOffset;
                        canvas2.drawText(String.valueOf(ch), f, y - ascent + this.StationMap_height / 2, this.StrPaint);
                    }
                    y += h_Spacing + mFontHeight;
                }
            }

        } else {


            if (index <= this.StationNum / 2) {
                if (index < this.StationCur) {
                    this.StrPaint.setColor(Color.parseColor("#8E8E8E"));
                } else if (index == this.StationCur) {
                    Paint rectPaint = new Paint();
                    rectPaint.setStyle(Paint.Style.FILL);
                    rectPaint.setColor(Color.parseColor("#C52B24"));
                    canvas.drawRoundRect(new RectF((offset - (this.StrPaint.getTextSize() / 2.0f)) - 3.0f, (float) (STATIONMAP_FLAGHEIGHT - 5), (this.StrPaint.getTextSize() / 2.0f) + offset + 3.0f, (float) (this.StationMap_height / 2 - 25)), 5f, 5f, rectPaint);
                    this.StrPaint.setColor(Color.parseColor("#ffffff"));
                } else {
                    this.StrPaint.setColor(Color.parseColor("#121212"));
                }
                float y = (float) STATIONMAP_FLAGHEIGHT;
                for (int n = 0; n < text.length(); n++) {
                    char ch = text.charAt(n);
                    if (ch == 65288 || ch == 65289 || ch == '(' || ch == ')') {
                        Path path = new Path();
                        path.moveTo(offset, y - h_Spacing);
                        path.lineTo(offset, y + mFontHeight);
                        canvas.drawTextOnPath(String.valueOf(ch), path, 0.0f, descent, this.StrPaint);
                    } else {
                        Canvas canvas2 = canvas;
                        float f = offset;
                        canvas2.drawText(String.valueOf(ch), f, y - ascent, this.StrPaint);
                    }
                    y += h_Spacing + mFontHeight;
                }

            } else {
                int newPos = this.StationNum - index - 1;
                float textOffset = (this.y_offset * ((float) newPos)) + 50.0f + (this.y_offset / 2.0f);
                if (index < this.StationCur) {
                    this.StrPaint.setColor(Color.parseColor("#8E8E8E"));
                } else if (index == this.StationCur) {
                    Paint rectPaint = new Paint();
                    rectPaint.setStyle(Paint.Style.FILL);
                    rectPaint.setColor(Color.parseColor("#C52B24"));
                    canvas.drawRoundRect(new RectF((textOffset - (this.StrPaint.getTextSize() / 2.0f)) - 3.0f, (float) (STATIONMAP_FLAGHEIGHT - 5) + this.StationMap_height / 2, (this.StrPaint.getTextSize() / 2.0f) + textOffset + 3.0f, (float) (this.StationMap_height - 25)), 5f, 5f, rectPaint);
                    this.StrPaint.setColor(Color.parseColor("#ffffff"));
                } else {
                    this.StrPaint.setColor(Color.parseColor("#121212"));
                }

                float y = (float) STATIONMAP_FLAGHEIGHT;
                Log.e(TAG, "drawStationNameText-----------textOffset------------------------- " + textOffset);

                for (int n = 0; n < text.length(); n++) {
                    char ch = text.charAt(n);
                    if (ch == 65288 || ch == 65289 || ch == '(' || ch == ')') {
                        Path path = new Path();
                        path.moveTo(textOffset, y - h_Spacing);
                        path.lineTo(textOffset, y + mFontHeight);
                        canvas.drawTextOnPath(String.valueOf(ch), path, 0.0f, descent, this.StrPaint);
                    } else {
                        Canvas canvas2 = canvas;
                        float f = textOffset;
                        canvas2.drawText(String.valueOf(ch), f, y - ascent + this.StationMap_height / 2, this.StrPaint);
                    }
                    y += h_Spacing + mFontHeight;
                }
            }


        }


        float r = (this.y_offset / 2.0f) - 2.0f;
        if (r > 12.0f) {
            r = 12.0f;
        }
        float cx = offset;
        Paint flagpaint = new Paint();
        flagpaint.setAntiAlias(true);
        flagpaint.setColor(Color.parseColor("#E2E2E2"));
        float offset_oval = (this.StationMap_width - (this.StationMap_width - (this.StationMap_width - 20 - offset_right)));

        if (this.StationNum % 2 == 0) {
            if (cx <= offset_oval) {
                canvas.drawCircle(cx, 30.0f, r, flagpaint);
                canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, r, flagpaint);
            }

            if (this.StationCur < this.StationNum / 2) {
                if (index < this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#B5B5B5"));
                } else if (index == this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#EB6100"));
                } else {
                    if (index == this.StationCur + 1) {
                        GlobalSetting.getInstance().icon_x = cx;
                        GlobalSetting.getInstance().icon_y = 30.0f;
                        GlobalSetting.getInstance().icon_r = (3.0f * r) / 5.0f;
                    }
                    if (this.StationCur + 1 == this.StationNum / 2) {
                        float targetS = (this.y_offset * ((float) (this.StationNum / 2 - 1))) + 50.0f + (this.y_offset / 2.0f);
                        GlobalSetting.getInstance().icon_x = targetS;
                        GlobalSetting.getInstance().icon_y = 30.0f + this.StationMap_height / 2;
                        GlobalSetting.getInstance().icon_r = (3.0f * r) / 5.0f;
                    }
                    flagpaint.setColor(Color.parseColor("#1EEA67"));
                }
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f, (3.0f * r) / 5.0f, flagpaint);
                }
                flagpaint.setColor(Color.parseColor("#1EEA67"));
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, (3.0f * r) / 5.0f, flagpaint);
                }

            } else {
                flagpaint.setColor(Color.parseColor("#B5B5B5"));
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f, (3.0f * r) / 5.0f, flagpaint);
                }

                int newPos = this.StationNum - index - 1;
                cx = (this.y_offset * ((float) newPos)) + 50.0f + (this.y_offset / 2.0f);
                if (index < this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#B5B5B5"));
                } else if (index == this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#EB6100"));
                } else {
                    if (index == this.StationCur + 1) {
                        float targetS = (this.y_offset * ((float) (newPos))) + 50.0f + (this.y_offset / 2.0f);
                        GlobalSetting.getInstance().icon_x = targetS;
                        GlobalSetting.getInstance().icon_y = 30.0f + this.StationMap_height / 2;
                        GlobalSetting.getInstance().icon_r = (3.0f * r) / 5.0f;
                    }
                    flagpaint.setColor(Color.parseColor("#1EEA67"));
                }
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, (3.0f * r) / 5.0f, flagpaint);
                }

            }
        } else {
            if (cx <= offset_oval) {
                canvas.drawCircle(cx, 30.0f, r, flagpaint);
            }
            float targetOffset = (this.y_offset * ((float) (this.StationNum / 2))) + 50.0f + (this.y_offset / 2.0f);
            if (cx <= offset_oval && targetOffset != cx) {
                canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, r, flagpaint);
            }
            if (this.StationCur < this.StationNum / 2) {
                if (index < this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#B5B5B5"));
                } else if (index == this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#EB6100"));
                } else {
                    if (index == this.StationCur + 1) {
                        GlobalSetting.getInstance().icon_x = cx;
                        GlobalSetting.getInstance().icon_y = 30.0f;
                        GlobalSetting.getInstance().icon_r = (3.0f * r) / 5.0f;
                    }
                    flagpaint.setColor(Color.parseColor("#1EEA67"));
                }
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f, (3.0f * r) / 5.0f, flagpaint);
                }

                flagpaint.setColor(Color.parseColor("#1EEA67"));
                if (cx <= offset_oval && targetOffset != cx) {
                    canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, (3.0f * r) / 5.0f, flagpaint);
                }
            } else if (this.StationCur == this.StationNum / 2) {
                if (index < this.StationNum / 2) {
                    flagpaint.setColor(Color.parseColor("#B5B5B5"));
                } else if (index == this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#EB6100"));
                } else {
                    if (index == this.StationCur + 1) {
                        float targetS = (this.y_offset * ((float) (this.StationNum / 2 - 1))) + 50.0f + (this.y_offset / 2.0f);
                        GlobalSetting.getInstance().icon_x = targetS;
                        GlobalSetting.getInstance().icon_y = 30.0f + this.StationMap_height / 2;
                        GlobalSetting.getInstance().icon_r = (3.0f * r) / 5.0f;
                    }
                    flagpaint.setColor(Color.parseColor("#1EEA67"));
                }
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f, (3.0f * r) / 5.0f, flagpaint);
                    if (targetOffset != cx) {
                        canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, (3.0f * r) / 5.0f, flagpaint);
                    }
                }

            } else {
                flagpaint.setColor(Color.parseColor("#B5B5B5"));
                if (cx <= offset_oval) {
                    canvas.drawCircle(cx, 30.0f, (3.0f * r) / 5.0f, flagpaint);
                }
                int newPos = (this.StationNum / 2) * 2 - index;
                cx = (this.y_offset * ((float) newPos)) + 50.0f + (this.y_offset / 2.0f);
                if (index < this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#B5B5B5"));
                } else if (index == this.StationCur) {
                    flagpaint.setColor(Color.parseColor("#EB6100"));
                } else {
                    if (index == this.StationCur + 1) {
                        float targetS = (this.y_offset * ((float) (newPos))) + 50.0f + (this.y_offset / 2.0f);
                        GlobalSetting.getInstance().icon_x = targetS;
                        GlobalSetting.getInstance().icon_y = 30.0f + this.StationMap_height / 2;
                        GlobalSetting.getInstance().icon_r = (3.0f * r) / 5.0f;
                    }
                    flagpaint.setColor(Color.parseColor("#1EEA67"));
                }
                if (cx <= offset_oval && targetOffset != cx) {
                    canvas.drawCircle(cx, 30.0f + this.StationMap_height / 2, (3.0f * r) / 5.0f, flagpaint);
                }
            }
        }
        this.StrPaint.setTextSize(fontsize);

    }

    private void drawSymbol(Canvas canvas, float offset, String str) {
        if (str.length() != 0) {
            float fontsize = this.StrPaint.getTextSize();
            this.StrPaint.setColor(ViewCompat.MEASURED_STATE_MASK);
            this.StrPaint.setTextAlign(Paint.Align.CENTER);
            this.StrPaint.setTextSize(40.0f);
            canvas.drawText(str, offset, ((((float) this.StationMap_height) - fontsize) + ((float) STATIONMAP_FLAGHEIGHT)) / 2.0f, this.StrPaint);
            this.StrPaint.setTextSize(fontsize);
            this.StrPaint.setTextAlign(Paint.Align.LEFT);
        }
    }

    private void drawArriveStationFlag(Canvas canvas, float offset) {
        Log.e(TAG, "offset_oval----------this.StationCur---------> " + this.StationCur);
        Paint flagpaint = new Paint();
        flagpaint.setAntiAlias(true);
        flagpaint.setColor(Color.parseColor("#B5B5B5"));

        Paint ovalpaint = new Paint();
        ovalpaint.setAntiAlias(true);
        ovalpaint.setStrokeWidth(10);
        ovalpaint.setColor(Color.parseColor("#B5B5B5"));
        ovalpaint.setStyle(Paint.Style.STROKE);
        int newPos = this.StationNum - 1 - this.StationCur;
        float newSet = (this.y_offset * ((float) newPos)) + 50.0f;
        float offset_oval = (this.StationMap_width - (this.StationMap_width - (this.StationMap_width - 20 - offset_right)) * 2);
        float offset_oval2 = (this.StationMap_width - (this.StationMap_width - (this.StationMap_width - 20 - offset_right)) );
        Log.e(TAG, "drawArriveStationFlag: ---------------newSet----------->" + newSet);
        Log.e(TAG, "drawArriveStationFlag: -------------offset------------->" + offset);
        Log.e(TAG, "drawArriveStationFlag: -------------offset_oval------------->" + offset_oval);
        if (this.StationNum % 2 == 0) {
            if (this.StationCur < this.StationNum / 2 - 1) {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset, 35.0f), 5.0f, 5.0f, flagpaint);
            } else if (this.StationCur == this.StationNum / 2 - 1) {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
            } else if (this.StationCur == this.StationNum / 2) {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
                if (offset < offset_oval) {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset, 35.0f), 5.0f, 5.0f, flagpaint);
                } else {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset_oval, 35.0f), 5.0f, 5.0f, flagpaint);
                }
                RectF oval = new RectF(offset_oval, 30f,
                        this.StationMap_width - 20, 35.0f + this.StationMap_height / 2 - 5.f);
                canvas.drawArc(oval, -90, 180, false, ovalpaint);//画圆弧，这个时候，绘制没有经过圆心

                int pos = this.StationNum - 1 - this.StationCur;
                float newOffset = (this.y_offset * ((float) pos)) + 50.0f + (this.y_offset / 2.0f) * 2;
                if ((this.StationMap_width - 20 - offset_right) < offset_oval) {
                    canvas.drawRoundRect(new RectF(newOffset, 25.0f + this.StationMap_height / 2, (this.StationMap_width - 20 - offset_right), 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);
                } else {
                    canvas.drawRoundRect(new RectF(newOffset, 25.0f + this.StationMap_height / 2, offset_oval, 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);
                }


            } else if (this.StationCur < this.StationNum - 1) {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
                if (offset < offset_oval) {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset, 35.0f), 5.0f, 5.0f, flagpaint);
                } else {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset_oval, 35.0f), 5.0f, 5.0f, flagpaint);
                }

                RectF oval = new RectF(offset_oval, 30f,
                        this.StationMap_width - 20, 35.0f + this.StationMap_height / 2 - 5.f);
                canvas.drawArc(oval, -90, 180, false, ovalpaint);//画圆弧，这个时候，绘制没有经过圆心

                int pos = this.StationNum - 1 - this.StationCur;
                float newOffset = (this.y_offset * ((float) pos)) + 50.0f;
                canvas.drawRoundRect(new RectF(newOffset, 25.0f + this.StationMap_height / 2, offset_oval + oval.width() / 2, 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);

            } else {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
                if (offset < offset_oval) {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset, 35.0f), 5.0f, 5.0f, flagpaint);
                } else {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset_oval, 35.0f), 5.0f, 5.0f, flagpaint);
                }
                RectF oval = new RectF(offset_oval, 30f,
                        this.StationMap_width - 20, 35.0f + this.StationMap_height / 2 - 5.f);
                canvas.drawArc(oval, -90, 180, false, ovalpaint);//画圆弧，这个时候，绘制没有经过圆心
                canvas.drawRoundRect(new RectF(20.0f, 25.0f + this.StationMap_height / 2, offset_oval + oval.width() / 2, 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);
            }

        } else {
            if (this.StationCur < this.StationNum / 2) {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset, 35.0f), 5.0f, 5.0f, flagpaint);
            } else if (this.StationCur == this.StationNum / 2) {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
            } else if (this.StationCur < this.StationNum - 1) {


                RectF oval = new RectF(offset_oval, 30f,
                        this.StationMap_width - 20, 35.0f + this.StationMap_height / 2 - 5.f);
                canvas.drawArc(oval, -90, 180, false, ovalpaint);//画圆弧，这个时候，绘制没有经过圆心
                Log.e(TAG, "offSSSet--------offset---->"+offset );
                Log.e(TAG, "offSSSet-------oval.width() ----->"+offset+ oval.width() / 2 );
                Log.e(TAG, "offSSSet-------offset_oval----->"+offset_oval);
                Log.e(TAG, "offSSSet-------offset_oval2----->"+offset_oval2);


                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);

                int pos = this.StationNum - 1 - this.StationCur;
                float newOffset = (this.y_offset * ((float) pos)) + 50.0f + (this.y_offset / 2.0f) * 2;
                canvas.drawRoundRect(new RectF(newOffset, 25.0f + this.StationMap_height / 2, offset_oval + oval.width() / 2, 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);

            } else {
                canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
                if (offset < offset_oval) {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset, 35.0f), 5.0f, 5.0f, flagpaint);
                } else {
                    canvas.drawRoundRect(new RectF(20.0f, 25.0f, offset_oval, 35.0f), 5.0f, 5.0f, flagpaint);
                }
                RectF oval = new RectF(offset_oval, 30f,
                        this.StationMap_width - 20, 35.0f + this.StationMap_height / 2 - 5.f);
                canvas.drawArc(oval, -90, 180, false, ovalpaint);//画圆弧，这个时候，绘制没有经过圆心
                canvas.drawRoundRect(new RectF(20.0f, 25.0f + this.StationMap_height / 2, offset_oval + oval.width() / 2, 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);
            }

        }

    }

    private void drawStationFlag(Canvas canvas) {
        Paint flagpaint = new Paint();
        flagpaint.setAntiAlias(true);
        flagpaint.setColor(Color.parseColor("#16bb51"));
        canvas.drawRoundRect(new RectF(20.0f, 25.0f, (this.StationMap_width - 20 - offset_right), 35.0f), 5.0f, 5.0f, flagpaint);
        float offset_oval = (this.StationMap_width - (this.StationMap_width - (this.StationMap_width - 20 - offset_right)) * 2);
        RectF oval = new RectF(offset_oval, 30f,
                this.StationMap_width - 20, 35.0f + this.StationMap_height / 2 - 5.f);
        Paint ovalpaint = new Paint();
        ovalpaint.setAntiAlias(true);
        ovalpaint.setStrokeWidth(10);
        ovalpaint.setColor(Color.parseColor("#16bb51"));
        ovalpaint.setStyle(Paint.Style.STROKE);
        canvas.drawArc(oval, -90, 180, false, ovalpaint);//画圆弧，这个时候，绘制没有经过圆心

        canvas.drawRoundRect(new RectF(20.0f, 25.0f + this.StationMap_height / 2, (this.StationMap_width - 20 - offset_right), 35.0f + this.StationMap_height / 2), 5.0f, 5.0f, flagpaint);
    }

    /* access modifiers changed from: protected */
    public void onDraw(Canvas canvas) {
        Paint paint = new Paint();
        paint.setColor(Color.parseColor("#ffffff"));
        //话白背景
        canvas.drawRect(new Rect(0, 0, this.StationMap_width, this.StationMap_height), paint);
        //画绿色的线
        drawStationFlag(canvas);
        if (this.SymbolWidth == 0) {
            //画已经过站的灰线
            for (int i = 0; i < this.MapCount; i++) {
                String[] array = this.NameString.get(i);
                int index = Integer.parseInt(array[0]);
                if (index == this.StationCur) {
                    drawArriveStationFlag(canvas, (this.y_offset * ((float) i)) + 50.0f + (this.y_offset / 2.0f));
                    break;
                }
            }

            //画文字和 闪烁的站点
            for (int i = 0; i < this.MapCount; i++) {
                drawStationNameText(canvas, (this.y_offset * ((float) i)) + 50.0f + (this.y_offset / 2.0f), i);
            }
        }
//        else if (this.StationCur <= 8) {
//            //红线绘制:左侧
//            for (int i = 0; i < 15; i++) {
//                if (i==this.StationCur){
//                    drawArriveStationFlag(canvas,(this.y_offset * ((float) i)) + 50.0f + (this.y_offset / 2.0f));
//                }
//            }
//            //绘制文字
//            for (int i2 = 0; i2 < 15; i2++) {
//                drawStationNameText(canvas, (this.y_offset * ((float) i2)) + 50.0f + (this.y_offset / 2.0f), i2);
//            }
//            drawSymbol(canvas, 110.0f + (this.y_offset * 15.0f), Symbol);
//            drawStationNameText(canvas, (this.y_offset * 15.0f) + 170.0f + (this.y_offset / 2.0f), this.StationNum - 1);
//        } else if (this.StationCur + 7 < this.StationNum - 1) {
//            drawStationNameText(canvas, (this.y_offset / 2.0f) + 50.0f, 0);
//            int len = ((this.StationCur - 10) * 8) / (this.StationNum - this.MapCount);
//            int len2 = len > 8 ? 9 : len + 1;
//            drawSymbol(canvas, this.y_offset + 50.0f + ((float) (len2 * 6)), Symbol.substring(0, len2));
//            int left = this.StationCur - 6;
//            int right = this.StationCur + 8;
//            //绘制红线 中间
//            for (int i3 = left; i3 < right; i3++) {
//                if (i3==this.StationCur){
//                    drawArriveStationFlag(canvas,((float) ((len2 * 12) + 50)) + (this.y_offset * ((float) ((i3 + 1) - left))) + (this.y_offset / 2.0f));
//                    break;
//                }
//            }
//            for (int i3 = left; i3 < right; i3++) {
//                drawStationNameText(canvas, ((float) ((len2 * 12) + 50)) + (this.y_offset * ((float) ((i3 + 1) - left))) + (this.y_offset / 2.0f), i3);
//            }
//            drawSymbol(canvas, ((float) ((len2 * 6) + 110)) + (this.y_offset * 15.0f), Symbol.substring(len2, 10));
//            drawStationNameText(canvas, (this.y_offset * 15.0f) + 170.0f + (this.y_offset / 2.0f), this.StationNum - 1);
//        } else {
//            drawStationNameText(canvas, (this.y_offset / 2.0f) + 50.0f, 0);
//            drawSymbol(canvas, 110.0f + this.y_offset, Symbol);
//            //绘制红线 右侧
//            for (int i4 = this.StationNum - 15; i4 < this.StationNum; i4++) {
//                if (i4==this.StationCur){
//                    drawArriveStationFlag(canvas,(this.y_offset * ((float) ((i4 - this.StationNum) + 16))) + 170.0f + (this.y_offset / 2.0f));
//                    break;
//                }
//            }
//            for (int i4 = this.StationNum - 15; i4 < this.StationNum; i4++) {
//                drawStationNameText(canvas, (this.y_offset * ((float) ((i4 - this.StationNum) + 16))) + 170.0f + (this.y_offset / 2.0f), i4);
//            }
//        }
    }

    /* access modifiers changed from: protected */
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        setMeasuredDimension(this.StationMap_width, this.StationMap_height);
    }

    public void setWidth_Height(int w, int h) {
        this.StationMap_width = w;
        this.StationMap_height = h;
        AutoSetSize();
        postInvalidate();
    }

    public void SetStationNum(int sum) {
        this.StationNum = sum;
        AutoSetSize();
        postInvalidate();
    }

    public boolean SetStationCur(int id) {
        if (id >= this.StationNum) {
            return false;
        }
        this.StationCur = id;
        postInvalidate();
        return true;
    }
}
